package ltd.hello.trik.snake;

import ltd.hello.trik.base.Context;
import peasy.PeasyCam;
import processing.core.PApplet;
import processing.core.PFont;

import java.util.ArrayList;

/**
 * +----------------------------------------------------------------------
 * |
 * +----------------------------------------------------------------------
 * | <a href="https://www.hellotrik.ltd">Copyright (c) 2024~2025 </a>.
 * +----------------------------------------------------------------------
 * | Licensed MIT
 * +----------------------------------------------------------------------
 * | 作者: 🦠 matrixg 👾 <hellotrik@foxmail.com>
 * | 日期: 2024/9/5
 * +----------------------------------------------------------------------
 */

public class SnakeCommon extends Context {
    public SnakeCommon(PApplet applet) {
        super(applet);
    }

    public static final int SIZE = 20;
    public static final int hidden_nodes = 32;
    public static final int hidden_layers = 2;
    public static final int fps = 144;  //15 is ideal for self play, increasing for AI does not directly increase speed, speed is dependant on processing power
    static protected PeasyCam cam;
    static protected int highscore = 0;
    static protected float mutationRate = 0.05f;
    static protected float defaultmutation = mutationRate;
    static protected boolean replayBest = true;  //shows only the best of each generation
    static protected boolean seeVision = false;  //see the snakes vision
    static protected boolean modelLoaded = false;
    static protected PFont font;
    static ArrayList<Integer> evolution;
    static EvolutionGraph graph;


    public static Integer[][] dir = new Integer[][]{
            {-1, 0, 0},
            {-1, -1, 0},
            {0, -1, 0},
            {1, -1, 0},
            {1, 0, 0},
            {0, 1, 0},
            {1, 1, 0},
            {-1, 1, 0},
            {-1, -1, -1},
            {-1, -1, 1},
            {-1, 0, -1},
            {-1, 0, 1},
            {-1, 1, -1},
            {-1, 1, 1},
            {0, -1, -1},
            {0, -1, 1},
            {0, 0, -1},
            {0, 0, 1},
            {0, 1, -1},
            {0, 1, 1},
            {1, -1, -1},
            {1, -1, 1},
            {1, 0, -1},
            {1, 0, 1},
            {1, 1, -1},
            {1, 1, 1}};

}
